import request from '@/utils/request'
import { downFile } from '@/utils/request'

/**
 * 销售订单分页查询
 * @param {查询条件} data
 */
export function listGbSalesOrder(query) {
  return request({
    url: 'Buss/GbSalesOrder/list',
    method: 'get',
    params: query,
  })
}

/**
 * 新增销售订单
 * @param data
 */
export function addGbSalesOrder(data) {
  return request({
    url: 'Buss/GbSalesOrder',
    method: 'post',
    data: data,
  })
}
/**
 * 修改销售订单
 * @param data
 */
export function updateGbSalesOrder(data) {
  return request({
    url: 'Buss/GbSalesOrder',
    method: 'PUT',
    data: data,
  })
}
/**
 * 获取销售订单详情
 * @param {Id}
 */
export function getGbSalesOrder(id) {
  return request({
    url: 'Buss/GbSalesOrder/' + id,
    method: 'get'
  })
}

/**
 * 删除销售订单
 * @param {主键} pid
 */
export function delGbSalesOrder(pid) {
  return request({
    url: 'Buss/GbSalesOrder/delete/' + pid,
    method: 'POST'
  })
}
// 导出销售订单
export async function exportGbSalesOrder(query) {
  await downFile('Buss/GbSalesOrder/export', { ...query })
}

//AI智能生成代码

export function API_QueryAI(data) {
  return request({
    url: 'Buss/GbInventory/QueryAI',
    method: 'get',
  })
}